package com.licw.zs.s397;

class p1 {
    public static void main(String[] args) {
        Solution solution = new Solution();
    }

    static
//leetcode submit region begin(Prohibit modification and deletion)
    class Solution {
        public int findPermutationDifference(String s, String t) {
            int[] sIdx = new int[26], tIdx = new int[26];
            for (int i = 0; i < s.length(); i++) {
                sIdx[s.charAt(i) - 'a'] = i;
                tIdx[s.charAt(i) - 'a'] = i;
            }
            int ans = 0;
            for (int i = 0; i < 26; i++) {
                ans += Math.abs(sIdx[i] - tIdx[i]);
            }
            return ans;
        }
    }
//leetcode submit region end(Prohibit modification and deletion)

}